package com.linghang.back.exception;

import lombok.Getter;

@Getter
public class BusinessException extends RuntimeException {
    
    private final int code;
    
    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }
    
    public BusinessException(String message) {
        this(400, message);  // 默认使用400作为业务错误码
    }
    
    public static BusinessException of(int code, String message) {
        return new BusinessException(code, message);
    }
    
    public static BusinessException of(String message) {
        return new BusinessException(message);
    }
} 